package com.ruoyi.eam.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.eam.doman.User;
import com.ruoyi.eam.service.IUserService;
import com.ruoyi.system.api.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.ParameterResolutionDelegate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/users")
public class UserController extends BaseController {

    @Autowired
    private IUserService iUserService;

    @GetMapping(value = "/{userPerson}")
    public AjaxResult getInfo(@PathVariable("userPerson")Long userperson){
        return success(iUserService.selectUserByUserId(userperson));
    }

    @GetMapping("/userDeptId")
    public TableDataInfo userDeptId(User user)
        {
            System.out.println(user.getDeptId());
            startPage();
            List<User> list = iUserService.selectUserByDeptId(user);
            return getDataTable(list);
        }
    @GetMapping("/list")
    public TableDataInfo list(User user)
    {
        startPage();
        List<User> list = iUserService.selectUserList(user);
        return getDataTable(list);
    }

}
